package com.ttn.student.openfeign;

import com.ttn.common.core.entity.Result;
import com.ttn.common.core.entity.business.CourseUnit;
import com.ttn.common.core.entity.business.Grade;
import com.ttn.common.core.entity.business.Order;
import com.ttn.student.openfeign.fallback.BusinessFeignServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

@FeignClient(name = "ttn-business", fallbackFactory = BusinessFeignServiceFallbackFactory.class)
public interface BusinessFeignService {

    @PostMapping("/course-unit-vocabulary/service/query/course-unit-vocabulary-course-unit-id/{courseUnitId}")
    Result<Long> serviceQueryCourseUnitVocabularyByCourseUnitId(@PathVariable("courseUnitId") Integer courseUnitId);

    @PostMapping("/course-unit-grammar-test/service/query/course-unit-grammar-test-by-course-unit-id/{courseUnitId}")
    Result<Long> serviceQueryCourseUnitGrammarTestByCourseUnitId(@PathVariable("courseUnitId") Integer courseUnitId);

    @PostMapping("/course-unit-hearing-details/service/query/course-unit-hearing-details-by-course-unit-id/{courseUnitId}")
    Result<Long> serviceQueryCourseCourseUnitHearingDetailsByCourseUnitId(@PathVariable("courseUnitId") Integer courseUnitId);

    @PostMapping("/course-unit-oral-practice/service/query/course-unit-oral-practice-by--course-unit-id/{courseUnitId}")
    Result<Long> serviceQueryCourseUnitOralPracticeByCourseUnitId(@PathVariable("courseUnitId") Integer courseUnitId);

    @PostMapping("/course-unit-oral-conversation/service/query/course-unit-oral-conversation-by-course-unit-id/{courseUnitId}")
    Result<Long> serviceQueryCourseUnitOralConversationByCourseUnitId(@PathVariable("courseUnitId") Integer courseUnitId);

    @GetMapping("/course-unit/service/query/course-unit-by-grade/{gradeId}")
    Result<List<CourseUnit>> serviceQueryCourseUnitByGrade(@PathVariable("gradeId") Integer gradeId);

    @GetMapping("/course-unit/service/query/course-unit-number-by-grade/{gradeId}")
    Result<Integer> serviceQueryCourseUnitNumberByGrade(@PathVariable("gradeId") Integer gradeId);

    @GetMapping("/course-unit/service/query/questions-number-by-unitId/{unitId}")
    Result<Integer> serviceQueryQuestionsNumberByUnitId(@PathVariable("unitId") Integer unitId);

    @GetMapping("/course-unit/service/query/course-unit-by-unit-id/{unitId}")
    Result<CourseUnit> serviceQueryCourseUnitByUnitId(@PathVariable("unitId") Integer unitId);

    @GetMapping("/grade/service/query/grade-id/{id}")
    Result<Grade> serviceQueryGradeById(@PathVariable("id") Integer id);

    @PostMapping("/order/query/service-order-details-by-student-id/{studentId}")
    Result<Order> queryServiceOrderDetailsByStudentId(@PathVariable Integer studentId);
}
